package com.toggery.POS.dao;

import com.toggery.POS.entity.User;
import com.toggery.POS.entity.UserExample;
import com.toggery.POS.entity.UserRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {
    long countByExample(UserExample example);

    int deleteByExample(UserExample example);

    int deleteByPrimaryKey(String id);

    int insert(User record);

    int insertSelective(User record);

    List<User> selectByExample(UserExample example);

    User selectByPrimaryKey(String id);

    int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);

    int updateByExample(@Param("record") User record, @Param("example") UserExample example);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);
    @Select({
            "select * from user where username=#{name,jdbcType=VARCHAR}"
    })
    User findByName(String name);
    @Select({
            "select * from user where username like #{name,jdbcType=VARCHAR}"
    })
    List<User> findLikeName(String name);
    @Select({
            "select * from user where id=#{id,jdbcType=VARCHAR}"
    })
    User findById(String id);

    List<UserRecord> queryForList();
}